package com.javaee.experiment2;

import org.springframework.context.ApplicationListener;
import org.springframework.stereotype.Component;

/**
 * @author: lzh
 */
@Component
public class NoticeListener implements ApplicationListener<NoticeEvent> {

    @Override
    public void onApplicationEvent(NoticeEvent noticeEvent) {
        System.out.println("事件监听器获取到NoticeEvent，睡眠当前线程2秒");
        try {
            Thread.sleep(2000);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println("NoticeEvent的message=" + noticeEvent.getMsg());
    }
}
